# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Forms.V1.Model.Question do
  @moduledoc """
  Any question. The specific type of question is known by its `kind`.

  ## Attributes

  *   `choiceQuestion` (*type:* `GoogleApi.Forms.V1.Model.ChoiceQuestion.t`, *default:* `nil`) - A respondent can choose from a pre-defined set of options.
  *   `dateQuestion` (*type:* `GoogleApi.Forms.V1.Model.DateQuestion.t`, *default:* `nil`) - A respondent can enter a date.
  *   `fileUploadQuestion` (*type:* `GoogleApi.Forms.V1.Model.FileUploadQuestion.t`, *default:* `nil`) - A respondent can upload one or more files.
  *   `grading` (*type:* `GoogleApi.Forms.V1.Model.Grading.t`, *default:* `nil`) - Grading setup for the question.
  *   `questionId` (*type:* `String.t`, *default:* `nil`) - Read only. The question ID. On creation, it can be provided but the ID must not be already used in the form. If not provided, a new ID is assigned.
  *   `ratingQuestion` (*type:* `GoogleApi.Forms.V1.Model.RatingQuestion.t`, *default:* `nil`) - A respondent can choose a rating from a pre-defined set of icons.
  *   `required` (*type:* `boolean()`, *default:* `nil`) - Whether the question must be answered in order for a respondent to submit their response.
  *   `rowQuestion` (*type:* `GoogleApi.Forms.V1.Model.RowQuestion.t`, *default:* `nil`) - A row of a QuestionGroupItem.
  *   `scaleQuestion` (*type:* `GoogleApi.Forms.V1.Model.ScaleQuestion.t`, *default:* `nil`) - A respondent can choose a number from a range.
  *   `textQuestion` (*type:* `GoogleApi.Forms.V1.Model.TextQuestion.t`, *default:* `nil`) - A respondent can enter a free text response.
  *   `timeQuestion` (*type:* `GoogleApi.Forms.V1.Model.TimeQuestion.t`, *default:* `nil`) - A respondent can enter a time.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :choiceQuestion => GoogleApi.Forms.V1.Model.ChoiceQuestion.t() | nil,
          :dateQuestion => GoogleApi.Forms.V1.Model.DateQuestion.t() | nil,
          :fileUploadQuestion => GoogleApi.Forms.V1.Model.FileUploadQuestion.t() | nil,
          :grading => GoogleApi.Forms.V1.Model.Grading.t() | nil,
          :questionId => String.t() | nil,
          :ratingQuestion => GoogleApi.Forms.V1.Model.RatingQuestion.t() | nil,
          :required => boolean() | nil,
          :rowQuestion => GoogleApi.Forms.V1.Model.RowQuestion.t() | nil,
          :scaleQuestion => GoogleApi.Forms.V1.Model.ScaleQuestion.t() | nil,
          :textQuestion => GoogleApi.Forms.V1.Model.TextQuestion.t() | nil,
          :timeQuestion => GoogleApi.Forms.V1.Model.TimeQuestion.t() | nil
        }

  field(:choiceQuestion, as: GoogleApi.Forms.V1.Model.ChoiceQuestion)
  field(:dateQuestion, as: GoogleApi.Forms.V1.Model.DateQuestion)
  field(:fileUploadQuestion, as: GoogleApi.Forms.V1.Model.FileUploadQuestion)
  field(:grading, as: GoogleApi.Forms.V1.Model.Grading)
  field(:questionId)
  field(:ratingQuestion, as: GoogleApi.Forms.V1.Model.RatingQuestion)
  field(:required)
  field(:rowQuestion, as: GoogleApi.Forms.V1.Model.RowQuestion)
  field(:scaleQuestion, as: GoogleApi.Forms.V1.Model.ScaleQuestion)
  field(:textQuestion, as: GoogleApi.Forms.V1.Model.TextQuestion)
  field(:timeQuestion, as: GoogleApi.Forms.V1.Model.TimeQuestion)
end

defimpl Poison.Decoder, for: GoogleApi.Forms.V1.Model.Question do
  def decode(value, options) do
    GoogleApi.Forms.V1.Model.Question.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Forms.V1.Model.Question do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
